#include "stdafx.h"
#include "rasterizer.h"


rasterizer16 * rasterizer16_create()
{
	rasterizer16 * pras = new rasterizer16;
	pras->options = 0;
	pras->ocount = 0;
	pras->oindex = 0;
	return pras;
}
void rasterizer16_destroy(rasterizer16 * pras)
{
	delete[] pras->options;
	delete pras;
}

option16 * rasterizer16_next_option(rasterizer16 * pras)
{
	if(pras->oindex == pras->ocount)
	{
		int_16 count = pras->ocount + 256;
		option16 * options = new option16[count];
		memcpy_s(options, count * sizeof(option16), pras->options, pras->ocount * sizeof(option16));
		delete[] pras->options;
		pras->options = options;
		pras->ocount = count;
	}
	option16 * ret = pras->options + pras->oindex;
	++pras->oindex;
	return ret;
}

void rasterizer16_option(rasterizer16 * pras, int_16 x, int_16 y, option_command cmd)
{
	rasterizer16_option_ex(pras, x,y, (int_16)cmd);
}
void rasterizer16_option_ex(rasterizer16 * pras, int_16 x, int_16 y, int_16 cmd)
{
	option16 * option = rasterizer16_next_option(pras);
	option->x = x;
	option->y = y;
	option->cmd = cmd;
}
